<template>
	<view class="content">
		<image class="logo" src="/static/logo.png"></image>
		<view class="text-area">
			<text class="title">{{title}}</text>
		</view>
    <view class="button" @click="getPoem">测试按钮</view>
	</view>
</template>



<script setup>
import { ref,onMounted } from 'vue'
import token from '@/utils/token.js'

const title = ref('Hello Zhu')

/**
 * 根据token获取信息和诗词
 * */
const getPoem = async () => {
  const res = await uni.request({
    // url: '/api/info',
    url: '/api/info',
    method: 'GET',
    header: {
      'X-User-Token': token,
    },
  })
  console.log(res)

  const res2 = await uni.request({
    // url: '/api/sentence',
    url: '/api/sentence',
    method: 'GET',
    header: {
      'X-User-Token': token,
    },
  })
  console.log(res2)
}

onMounted(() => {})

</script>

<style scoped lang="scss">
	.content {
		display: flex;
		flex-direction: column;
		align-items: center;
		justify-content: center;
    .button{
      width: 150rpx;
      height: 80rpx;
      background-color: red;
      color: white;
      display: flex;
      justify-content: center;
      align-items: center;
      border-radius: 20rpx;
      &:active{
        background-color: green;
      }
    }
    .logo {
      height: 200rpx;
      width: 200rpx;
      margin: 200rpx auto 50rpx;
    }
    .text-area {
      display: flex;
      justify-content: center;
      .title {
        font-size: 36rpx;
        color: #8f8f94;
      }
    }
	}
</style>
